package com.ruoyi.project.jiaqin.advertcontract.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.jiaqin.advertcontract.domain.JiaqinAdvertContract;
import com.ruoyi.project.jiaqin.advertcontract.mapper.JiaqinAdvertContractMapper;
import com.ruoyi.project.jiaqin.advertcontract.service.IJiaqinAdvertContractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * 广告合同Service业务层处理
 * 
 * @author LCL
 * @date 2021-10-28
 */
@Service
public class JiaqinAdvertContractServiceImpl implements IJiaqinAdvertContractService 
{
    @Autowired
    private JiaqinAdvertContractMapper jiaqinAdvertContractMapper;

    /**
     * 查询广告合同
     * 
     * @param id 广告合同ID
     * @return 广告合同
     */
    @Override
    public JiaqinAdvertContract selectJiaqinAdvertContractById(String id)
    {
        return jiaqinAdvertContractMapper.selectJiaqinAdvertContractById(id);
    }

    /**
     * 查询广告合同列表
     * 
     * @param jiaqinAdvertContract 广告合同
     * @return 广告合同
     */
    @Override
    public List<JiaqinAdvertContract> selectJiaqinAdvertContractList(JiaqinAdvertContract jiaqinAdvertContract)
    {
        return jiaqinAdvertContractMapper.selectJiaqinAdvertContractList(jiaqinAdvertContract);
    }

    /**
     * 新增广告合同
     * 
     * @param jiaqinAdvertContract 广告合同
     * @return 结果
     */
    @Override
    public int insertJiaqinAdvertContract(JiaqinAdvertContract jiaqinAdvertContract)
    {
        jiaqinAdvertContract.setId(UUID.randomUUID().toString().replace("-",""));
        jiaqinAdvertContract.setCreatedTime(new Date());
        return jiaqinAdvertContractMapper.insertJiaqinAdvertContract(jiaqinAdvertContract);
    }

    /**
     * 修改广告合同
     * 
     * @param jiaqinAdvertContract 广告合同
     * @return 结果
     */
    @Override
    public int updateJiaqinAdvertContract(JiaqinAdvertContract jiaqinAdvertContract)
    {
        jiaqinAdvertContract.setUpdatedTime(new Date());
        return jiaqinAdvertContractMapper.updateJiaqinAdvertContract(jiaqinAdvertContract);
    }

    /**
     * 删除广告合同对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteJiaqinAdvertContractByIds(String ids)
    {
        return jiaqinAdvertContractMapper.deleteJiaqinAdvertContractByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除广告合同信息
     * 
     * @param id 广告合同ID
     * @return 结果
     */
    @Override
    public int deleteJiaqinAdvertContractById(String id)
    {
        return jiaqinAdvertContractMapper.deleteJiaqinAdvertContractById(id);
    }

    @Override
    public List<JiaqinAdvertContract> findAdvertContractList(String memberId) {
        return jiaqinAdvertContractMapper.findAdvertContractList(memberId);
    }

    @Override
    public JiaqinAdvertContract findAdvertContractByMemberIdCooperateIdStatus(String memberId, String advertCooperateId, Integer status) {
        return jiaqinAdvertContractMapper.findAdvertContractByMemberIdCooperateIdStatus(memberId, advertCooperateId, status);
    }

    @Override
    public JiaqinAdvertContract findAdvertContractByOutTradeNo(String outTradeNo) {
        return jiaqinAdvertContractMapper.findAdvertContractByOutTradeNo(outTradeNo);
    }

    @Override
    public JiaqinAdvertContract findByOrderNo(String orderNo) {
        return jiaqinAdvertContractMapper.findByOrderNo(orderNo);
    }
}
